package com.manager.traffic.controller;

import com.manager.common.constant.TcpDataType;
import com.manager.common.customer.utils.RemoteExecute;
import com.manager.common.utils.DataTools;
import com.manager.common.vo.ResultVO;
import net.sf.json.JSONObject;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName OutlierLogController
 * @Description TODO
 * @Author @LiuHongJun
 * @Date 2025-10-09 21:24
 * @Version 1.0
 */
@RestController
@RequestMapping("/outerLog")
public class OutlierLogController {

    @RequestMapping("/gather")
    public ResultVO gather() {
        try{

            String url = DataTools.getSystemSettingStringValByKey("issue_instructions_url");
            JSONObject request = new JSONObject();
            request.put("code", TcpDataType.OUTER_LOG_FILES_INFO.getCode());

            JSONObject params = new JSONObject();
            String serialNumber = DataTools.getSerialNumber();
            params.put("serialNumber", serialNumber);
            request.put("content",params);
            RemoteExecute.executeTcpInstruction(url, request.toString());
            DataTools.putWebSessionId(serialNumber);
            return ResultVO.success();

        }catch (Exception e){
            e.printStackTrace();
        }
        return ResultVO.failed();
    }
}
